package com.tanxi521.tnweb.utils;

import java.io.Serializable;

public class PageInfo implements Serializable {

    private Integer pageSize;
    private Long totalCount;
    private Long cunPage;
    private Integer firstPage = 1;
    private Long lastPage;

    public PageInfo(Integer pageSize) {
        this.pageSize = pageSize;
    }

    @Override
    public String toString() {
        return "PageInfo{" +
                "pageSize=" + pageSize +
                ", totalCount=" + totalCount +
                ", cunPage=" + cunPage +
                ", firstPage=" + firstPage +
                ", lastPage=" + lastPage +
                '}';
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }

    public Long getCunPage() {
        return cunPage;
    }

    public void setCunPage(Long cunPage) {
        this.cunPage = cunPage;
    }

    public Integer getFirstPage() {
        return firstPage;
    }

    public Long getLastPage() {
        return totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
    }
}
